<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>注册页面 </title>
    <link rel="stylesheet" href="/home/css/reset.css">
    <link rel="stylesheet" href="/home/css/head-footer.css">
    <link rel="stylesheet" href="/home/css/login.css">
    <style type="text/css">
        .font{
            font-size: 200%;
            margin-left: 280px;
            font-weight: bold;
            margin-top: 30px;
            color: #ff9900;
        }
    </style>
</head>

<body>
    <!-- 头部 -->
    <div class="header-wrap">
        <div class="header-top-wrap">
            <div class="header-top clearfixa">
                <div class="logo-box fl">
                    <a href="javascript:void(0)">
                        <img src="/home/images/logo.png" alt="">
                    </a>
                </div>
                <div class="login-api-box fr">
                    <span><a href="{:url('login/login')}">登录</a></span>/
                    <span><a href="{:url('login/index')}">注册</a></span>
                </div>
            </div>
        </div>
        <div class="header-bottom-wrap">
            <div class="header-bottom">
                <div class="second-logo-box">
                    <a href="javascript:void(0)">
                        <img src="/home/images/teacher-logo.png" alt="">
                    </a>
                </div>
            </div>
        </div>
    </div>
    <!-- 主体内容 -->
    <div class="login-main-wrap">
        <div class="second-nav">
            <span><a href="javascript:void(0)">首页</a></span>
            >
            <span><a href="javascript:void(0)">登录</a></span>
        </div>
        <div class="login-main-box login1-main-box">
            <div class="font">商家注册页面</div>
            <h1 class="login-speed-api"><a href="{:url('login/login')}">快速登录</a></h1>
            <div class="login-main">
                <form>
                    <label for="" class="login-information-box">
                        <span class="login-information-name">姓名：</span>
                        <input type="text" placeholder="请输入用户名" name="agent_username" id="agent_username">
                    </label>
                    <label for="" class="login-information-box">
                        <span class="login-information-phone">手机号：</span>
                        <input style="width:199px" type="text" placeholder="请输入手机号" name="agent_password" id="agent_tel">
                    </label>
                    <label for="" class="login-information-box">
                        <span class="login-information-phone">密码：</span>
                        <input type="password" placeholder="请输入密码" name="agent_password" id="agent_password">
                    </label>
                    <label for="" class="login-information-box">
                        <span class="login-information-phone">确认密码：</span>
                        <input style="width:192px" type="password" placeholder="请输入密码" name="agent_password_copy" id="agent_password_copy">
                    </label>
                    <input class="login-submit" type="button" id="button" value="提交">
                </form>
            </div>
        </div>
    </div>
    {include file='base/footer' /}
</body>


</html>
<script src="http://libs.baidu.com/jquery/2.1.1/jquery.min.js"></script>
<script src="/home/js/layer-v/layer/layer.js"></script>
<script>
     $(document).on('click','#button',function(){
                    
                var agent_username = $('#agent_username').val();
                var agent_password = $('#agent_password').val();
                var agent_password_copy = $('#agent_password_copy').val();
                var agen_tel = $('#agent_tel').val();

                if(agent_password !== "" || agent_username !== "" || agent_password !== agent_password_copy)
                {
                     $.ajax({
                        url:"{:url('login/regin')}",
                        data:{
                            agent_username : agent_username,
                            agent_password : agent_password,
                            agent_tel : agen_tel,
                        },
                        dataType:'json',
                        type:'post',
                        success:function(data)
                        {
                            // console.log(data);return false;
                            if(data.code == '1000')
                            {
                                  layer.msg('注册成功', {
                                  icon: 16
                                  ,shade: 0.01
                                });
                                window.location.href = "{:url('Login/login')}";
                            }else if(data.code == '1003'){
                                  
                                  layer.msg('此用户已注册', function(){
                                    //关闭后的操作
                                    return false;
                                })
                            }
                            else
                            {
                               layer.msg('注册失败', function(){
                                    //关闭后的操作
                                    return false;
                                })
                            }                      
                        }
                    })
                }else
                {
                    layer.msg('请填写完整', function(){
                                    //关闭后的操作
                                    return false;
                                })
                }

            
            })
</script>

</html>

